package com.java8.stream.dome;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class Test2 {

    /**
     * Stream 与 数组 列表直接的相互转换
     */
    public static void master() {
        System.out.println("-----------------Test2.master()-----------------");

        //Stream.of()
        Stream<String> stream = Stream.of("悟空", "唐僧", "八戒", "悟净", "白龙马");

        //Arrays.
        String[] strArray = new String[]{"悟空", "唐僧", "八戒", "悟净", "白龙马"};
        stream = Stream.of(strArray);
        stream = Arrays.stream(strArray);

        //Conllections.
        List<String> list = Arrays.asList("悟空", "唐僧", "八戒", "悟净", "白龙马");
        stream = list.stream();

    }
}
